﻿package mortal.game.view.shop
{
    import Message.Public.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flashx.textLayout.formats.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class BuyItemMoneyPart extends GSprite
    {
        private var _priceIcon1:GBitmap;
        private var _priceIcon2:GBitmap;
        private var _btnBindGold:GTextFiled;
        private var _btnUnBindGold:GTextFiled;

        public function BuyItemMoneyPart()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.size = 14;
            this.pushUIToDisposeVec(UIFactory.gTextField(Language.getString(35538), 0, 0, 70, 30, this, _loc_1, true));
            _loc_1 = GlobalStyle.textFormatChen;
            this.pushUIToDisposeVec(UIFactory.gTextField(Language.getString(35539), 80, 6, 50, 30, this, _loc_1.left(), true));
            this.pushUIToDisposeVec(UIFactory.gTextField(Language.getString(35540), 80, 31, 80, 30, this, _loc_1.left(), true));
            _loc_1.align = TextAlign.RIGHT;
            this._btnUnBindGold = UIFactory.gTextField("", 115, 6, 100, 20, this, _loc_1);
            this._btnBindGold = UIFactory.gTextField("", 115, 31, 100, 20, this, _loc_1);
            this._priceIcon1 = UIFactory.gBitmap(GameDefConfig.instance.getEPrictUnitImg(EPriceUnit._EPriceUnitGold), 215, 6, this);
            this._priceIcon2 = UIFactory.gBitmap(GameDefConfig.instance.getEPrictUnitImg(EPriceUnit._EPriceUnitGoldBind), 215, 31, this);
            this.updateMoney();
            NetDispatcher.addCmdListener(ServerCommand.MoneyUpdate, this.updateMoney);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            NetDispatcher.removeCmdListener(ServerCommand.MoneyUpdate, this.updateMoney);
            this._btnBindGold.dispose(param1);
            this._btnBindGold = null;
            this._btnUnBindGold.dispose(param1);
            this._btnUnBindGold = null;
            this._priceIcon1.dispose(param1);
            this._priceIcon1 = null;
            this._priceIcon2.dispose(param1);
            this._priceIcon2 = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function updateMoney(param1:Object = null) : void
        {
            this._btnBindGold.text = Cache.instance.role.getMoneyByType(EPriceUnit._EPriceUnitGoldBind).toString();
            this._btnUnBindGold.text = Cache.instance.role.getMoneyByType(EPriceUnit._EPriceUnitGold).toString();
            return;
        }// end function

    }
}
